package com.example.demo.rabbit.consumer;

import com.example.demo.rabbit.common.RabbitConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import static java.nio.charset.StandardCharsets.UTF_8;
@Slf4j
@Component
public class Consumer {
    @RabbitListener(queues = RabbitConstants.Queue.QUEUE_FROM)
    public void deadHandle(Message msg){
        String message = new String(msg.getBody(), UTF_8);
        log.info("receive message @{}",message);
    }
}
